<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org">
<!--在这里写你的css-->
<div th:fragment="stylesheet">

</div>
<!--在这里写你的内容-->

<body id="test" th:fragment="content">

<div class="panel" style="padding: 10px">
    <div class="panel-heading">
        <h3 class="panel-title">添加健康档案</h3>
    </div>
    <form name="add_health_info">
        <div>
            <div class="box-body col-md-4">
                <label for="healthRecordId">档案编号</label>
                <input id="healthRecordId" type="text" class="form-control" placeholder="输入档案编号">
                <br>
                <label for="telephone">手机号码</label>
                <input id="telephone" type="text" class="form-control" placeholder="输入手机号码">
                <br>
                <label for="selRegistrationId">自助挂号编号</label>
                <input id="selRegistrationId" type="text" class="form-control" placeholder="输入自助挂号编号">
                <br>
                <label for="furReturnId">复诊编号</label>
                <input id="furReturnId" type="text" class="form-control" placeholder="输入复诊编号">
                <br>
                <label for="recordBuildorganization">档案创建单位</label>
                <input id="recordBuildorganization" type="text" class="form-control" placeholder="输入档案创建单位">
                <br>
                <label for="recordCreatedate">档案创建时间</label>
                <input id="recordCreatedate" type="text" class="form-control" placeholder="输入档案创建时间">
                <br>
                <label for="occupation">职业</label>
                <input id="occupation" type="text" class="form-control" placeholder="输入职业">
                <br>
                <label for="maritalStatus">婚姻情况</label>
                <input id="maritalStatus" type="text" class="form-control" placeholder="输入婚姻情况">
                <br>
            </div>
            <div class="box-body col-md-4">
                <label for="drugallergyHistory">过敏史</label>
                <input id="drugallergyHistory" type="text" class="form-control" placeholder="输入过敏史">
                <br>
                <label for="expousreHistory">暴露史</label>
                <input id="expousreHistory" type="text" class="form-control" placeholder="输入暴露史">
                <br>
                <label for="diseaseHistory">疾病史</label>
                <input id="diseaseHistory" type="text" class="form-control" placeholder="输入疾病史">
                <br>
                <label for="disability">残疾</label>
                <input id="disability" type="text" class="form-control" placeholder="输入残疾">
                <br>
                <label for="symptom">症状</label>
                <input id="symptom" type="text" class="form-control" placeholder="输入症状">
                <br>
                <label for="exercise">锻炼情况</label>
                <input id="exercise" type="text" class="form-control" placeholder="输入锻炼情况">
                <br>
                <label for="eatingHabit">饮食情况</label>
                <input id="eatingHabit" type="text" class="form-control" placeholder="输入饮食情况">
                <br>
                <label for="smoking">吸烟情况</label>
                <input id="smoking" type="text" class="form-control" placeholder="输入吸烟情况">
                <br>
            </div>
            <div class="box-body col-md-4">
                <label for="drinking">饮酒情况</label>
                <input id="drinking" type="text" class="form-control" placeholder="输入饮酒情况">
                <br>
                <label for="paymentMethod">支付方式</label>
                <input id="paymentMethod" type="text" class="form-control" placeholder="输入支付方式">
                <br>
                <label for="livingEnvironment">生活环境</label>
                <input id="livingEnvironment" type="text" class="form-control" placeholder="输入生活环境">
                <br>
                <label for="physicalexamId">体检编号</label>
                <input id="physicalexamId" type="text" class="form-control" placeholder="输入体检编号">
                <br>
                <label for="clinicId">诊所编号</label>
                <input id="clinicId" type="text" class="form-control" placeholder="输入诊所编号">
                <br>
                <label for="registrationId">挂号编号</label>
                <input id="registrationId" type="text" class="form-control" placeholder="输入挂号编号">
                <br>
                <label for="returnId">复诊编号</label>
                <input id="returnId" type="text" class="form-control" placeholder="输入复诊编号">
                <br>
                <label for="recentStateId">近况编号</label>
                <input id="recentStateId" type="text" class="form-control" placeholder="输入近况编号">
                <br>
            </div>
        </div>

        <div  class="box-body ">
            <button id="submit" type="button" class="btn btn-primary btn-block">确定</button>
        </div>

    </form>
</div>
</body>
<!--在这里定义或者引用你的script-->
<div th:fragment="script">
    <script>;
    $('#submit').click(function(){
        $.ajax({
            type: "post",
            url: "/healthRecord/add",
            data:
            {
                healthRecordId: $("#healthRecordId").val(),
                telephone: $("#telephone").val(),
                selRegistrationId: $("#selRegistrationId").val(),
                furReturnId: $("#furReturnId").val(),
                recordBuildorganization: $("#recordBuildorganization").val(),
                recordCreatedate: $("#recordCreatedate").val(),
                occupation: $("#occupation").val(),
                maritalStatus: $("#maritalStatus").val(),
                drugallergyHistory: $("#drugallergyHistory").val(),
                expousreHistory: $("#expousreHistory").val(),
                diseaseHistory: $("#diseaseHistory").val(),
                disability: $("#disability").val(),
                exercise: $("#exercise").val(),
                eatingHabit: $("#eatingHabit").val(),
                smoking: $("#smoking").val(),
                drinking: $("#drinking").val(),
                livingEnvironment: $("#livingEnvironment").val(),
                physicalexamId: $("#physicalexamId").val(),
                clinicId: $("#clinicId").val(),
                registrationId: $("#registrationId").val(),
                returnId: $("#returnId").val(),
                recentStateId: $("#recentStateId").val(),
                // createTime: new Date,
                // updateTime: new Date,
            },
            success: function (data,status) {
                // alert(JSON.stringify(data))
                if(data.code==200){
                    alert("successful");
                    $("#test").load(location.href + "#test");//重新加载整个<body>
                }else{
                    alert("添加失败，档案编号已经存在");
                }

            },
            error:function (data) {
                alert("error");
            }
        });
    })
    </script>
</div>

</html>